import request from '@/utils/request'

const api = {
  merchantContractQuery: '/merchantContract/query',
  custContractQuery: '/merchantContract/custContract/query',
  custBillQuery: '/merchantContract/custBill/query',
  addMerchantContract: '/merchantContract/add',
  appendMerchantContract: '/merchantContract/append',
  merchantContractDtl: '/merchantContract/detail',
  serviceFeeMarkPay: '/merchantContract/serviceFeeMarkPay',
  allocate: '/merchantContract/allocate',
  markPay: '/custBill/markPay'
}

/**
 * merchantContractQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     contractNo: '',
 *     userKeyword'',
 *     merchantKeyword:'',
 *     repaymentSeq:'',
 *     billType:'',
 *     repaymentStatus:'',
 *     merchantContractNo:'',
 *     startShouldRepaymentTime:'',
 *     endShouldRepaymentTime:'',
 *     startActualRepaymentTime:'',
 *     endActualRepaymentTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantContractList (parameter) {
  return request({
    url: api.merchantContractQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * custContractQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     templateKeyword: '',
 *     userKeyword: '',
 *     merchantKeyword'',
 *     repaymentStatus:'',
 *     capitalContractStatus:'',
 *     merchantContractNo:'',
 *     serviceFeePayStatus:'',
 *     startCreateTime:'',
 *     endCreateTime:'',
 *     endReceiveHandleResult:'',
 *     startSignCompleteTime:'',
 *     endSignCompleteTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function getCustContractList (parameter) {
  return request({
    url: api.custContractQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * custBillQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     contractNo: '',
 *     userKeyword'',
 *     merchantKeyword:'',
 *     repaymentSeq:'',
 *     billType:'',
 *     repaymentStatus:'',
 *     merchantContractNo:'',
 *     startShouldRepaymentTime:'',
 *     endShouldRepaymentTime:'',
 *     startActualRepaymentTime:'',
 *     endActualRepaymentTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function getCustBillList (parameter) {
  return request({
    url: api.custBillQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * addMerchantContract func
 * parameter: {
 *     netsignContractNo: '',
 *     merchantId: '',
 *     capitalId: '',
 *     loanAmount:'',
 *     monthRepaymentAmount:'',
 *     serviceFeeAmount:'',
 *     repaymentDay:'',
 *     pics:'',
 *     serviceFeePayStatus:'',
 *     isUnfreeze:'',
 *     contractList:[{contractNo:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function addMerchantContract (parameter) {
  return request({
    url: api.addMerchantContract,
    method: 'post',
    data: parameter
  })
}

/**
 * appendMerchantContract func
 * parameter: {
 *     contractNo: '',
 *     serviceFeeAmount: '',
 *     pics: '',
 *     contractList:[{contractNo:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function appendMerchantContract (parameter) {
  return request({
    url: api.appendMerchantContract,
    method: 'post',
    data: parameter
  })
}

/**
 * merchantContractDtl func
 * parameter: {
 *     contractNo: ''
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantContractDtl (parameter) {
  return request({
    url: api.merchantContractDtl,
    method: 'post',
    data: parameter
  })
}

/**
 * serviceFeeMarkPay func
 * parameter: {
 *     contractNo: '',
 *     pics:''
 * }
 * @param parameter
 * @returns {*}
 */
export function serviceFeeMarkPay (parameter) {
  return request({
    url: api.serviceFeeMarkPay,
    method: 'post',
    data: parameter
  })
}

/**
 * allocate func
 * parameter: {
 *     contractNo: '',
 *     capitalAllocateAmount: '',
 *     remark: '',
 * }
 * @param parameter
 * @returns {*}
 */
export function allocate (parameter) {
  return request({
    url: api.allocate,
    method: 'post',
    data: parameter
  })
}

/**
 * markPay func
 * parameter: {
 *     repaymentId: '',
 *     remark:''
 * }
 * @param parameter
 * @returns {*}
 */
export function markPay (parameter) {
  return request({
    url: api.markPay,
    method: 'post',
    data: parameter
  })
}
